//
//  HMDiscoverSearchView.swift
//  FirstSinaProject-00
//
//  Created by mac on 16/4/8.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

class HMDiscoverSearchView: UIView {
    
    @IBOutlet weak var cancleBtn: UIButton!
    @IBOutlet weak var textView: UITextField!
    @IBOutlet weak var rightCons: NSLayoutConstraint!
    
    //重写NIB方法自定义
    override func awakeFromNib() {
       self.frame =  CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, 35)
        
        self.textView.leftView = UIImageView(image: UIImage(named: "tabbar_discover"))
        self.textView.leftView?.frame = CGRectMake(0, 0, self.bounds.height, self.bounds.height)
        self.textView.leftView?.contentMode = .Center
        self.textView.leftViewMode = .Always
        
        
    }
    //创建类方法供外界调用
    class func searchView () -> HMDiscoverSearchView{
        let view = NSBundle.mainBundle().loadNibNamed("HMDiscoverSearchView", owner: nil, options: nil).last! as! HMDiscoverSearchView
        return view
    }

    
    @IBAction func BTnClick(sender: UIButton) {
    }
    
    @IBAction func textFiledClick(sender: AnyObject) {
        rightCons.constant = cancleBtn.bounds.width
        
    }
    


    
    
    
    
    
    
    
    
    
    
    
}
